package com.edgclub.edg.api;

import android.content.Context;

import com.edgclub.edg.api.param.RechargeParam;
import com.edgclub.edg.api.param.UserParam;
import com.edgclub.edg.http.VolleyListener;
import com.edgclub.edg.http.async.AsyncHttpClient;

import java.util.ArrayList;

public class RechargeApi extends GuZhiApi {

	// 用来管理所有的请求的线程
	private ArrayList<String> tags = new ArrayList<String>();

	private AsyncHttpClient asyncHttpClient;

	public RechargeApi(Context mContext) {
		super(mContext);
	}


	/**
	 * 获取Charge
	 * 
	 * @param params
	 * @param listener
	 */
	public void recharge(RechargeParam params, VolleyListener listener) {
		postCharge(ApiConfig.APIURL.URL_CHARGE,
				ApiConfig.APIURL.URL_CHARGE, params, listener);
		tags.add(ApiConfig.APIURL.URL_CHARGE);
	}

	public void queryOrder(RechargeParam params, VolleyListener listener) {
		postCharge(ApiConfig.APIURL.URL_QUERYORDER,
				ApiConfig.APIURL.URL_QUERYORDER, params, listener);
		tags.add(ApiConfig.APIURL.URL_QUERYORDER);
	}

	public void queryBalance(RechargeParam params, VolleyListener listener) {
		postCharge(ApiConfig.APIURL.URL_QUERYBANANCE,
				ApiConfig.APIURL.URL_QUERYBANANCE, params, listener);
		tags.add(ApiConfig.APIURL.URL_QUERYBANANCE);
	}

	public void queryRedDetail(RechargeParam params, VolleyListener listener) {
		postCharge(ApiConfig.APIURL.URL_QUERYREDDETAIL,
				ApiConfig.APIURL.URL_QUERYREDDETAIL, params, listener);
		tags.add(ApiConfig.APIURL.URL_QUERYREDDETAIL);
	}

	public void getCode(UserParam params, VolleyListener listener) {
		postCharge1(ApiConfig.APIURL.URL_GETCODE,
				ApiConfig.APIURL.URL_GETCODE, params, listener);
		tags.add(ApiConfig.APIURL.URL_GETCODE);
	}
	public void getCode1(UserParam params, VolleyListener listener) {
		postCharge1(ApiConfig.APIURL.URL_GETCODE1,
				ApiConfig.APIURL.URL_GETCODE1, params, listener);
		tags.add(ApiConfig.APIURL.URL_GETCODE1);
	}
	public void setPass(RechargeParam params, VolleyListener listener) {
		postCharge(ApiConfig.APIURL.URL_SetPAYPWD,
				ApiConfig.APIURL.URL_SetPAYPWD, params, listener);
		tags.add(ApiConfig.APIURL.URL_SetPAYPWD);
	}
	public void getPass(RechargeParam params, VolleyListener listener) {
		postCharge(ApiConfig.APIURL.URL_GetPAYPWD,
				ApiConfig.APIURL.URL_GetPAYPWD, params, listener);
		tags.add(ApiConfig.APIURL.URL_GetPAYPWD);
	}
	public void resetPass(RechargeParam params, VolleyListener listener) {
		postCharge(ApiConfig.APIURL.URL_RestPAYPWD,
				ApiConfig.APIURL.URL_RestPAYPWD, params, listener);
		tags.add(ApiConfig.APIURL.URL_RestPAYPWD);
	}
	public void CheckPass(RechargeParam params, VolleyListener listener) {
		postCharge(ApiConfig.APIURL.URL_CHECKPASS,
				ApiConfig.APIURL.URL_CHECKPASS, params, listener);
		tags.add(ApiConfig.APIURL.URL_CHECKPASS);
	}
	public void queryTransactionDetail(RechargeParam params, VolleyListener listener) {
		postCharge(ApiConfig.APIURL.URL_QUERYTRANSACTIONDETAIL,
				ApiConfig.APIURL.URL_QUERYTRANSACTIONDETAIL, params, listener);
		tags.add(ApiConfig.APIURL.URL_QUERYTRANSACTIONDETAIL);
	}
	public void createRed(RechargeParam params, VolleyListener listener) {
		postCharge(ApiConfig.APIURL.URL_CREATE_RED,
				ApiConfig.APIURL.URL_CREATE_RED, params, listener);
		tags.add(ApiConfig.APIURL.URL_CREATE_RED);
	}
	public void deleteRed(RechargeParam params, VolleyListener listener) {
		postCharge(ApiConfig.APIURL.URL_DELETE_RED,
				ApiConfig.APIURL.URL_DELETE_RED, params, listener);
		tags.add(ApiConfig.APIURL.URL_DELETE_RED);
	}

	public void openRed(RechargeParam params, VolleyListener listener) {
		postCharge(ApiConfig.APIURL.URL_OPEN_RED,
				ApiConfig.APIURL.URL_OPEN_RED, params, listener);
		tags.add(ApiConfig.APIURL.URL_OPEN_RED);
	}

	public void openRedDetail(RechargeParam params, VolleyListener listener) {
		postCharge(ApiConfig.APIURL.URL_OPEN_RED_DETAIL,
				ApiConfig.APIURL.URL_OPEN_RED_DETAIL, params, listener);
		tags.add(ApiConfig.APIURL.URL_OPEN_RED_DETAIL);
	}

	public void sendRedToUser(RechargeParam params, VolleyListener listener) {
		postCharge(ApiConfig.APIURL.URL_SEND_RED_TO_USER,
				ApiConfig.APIURL.URL_SEND_RED_TO_USER, params, listener);
		tags.add(ApiConfig.APIURL.URL_SEND_RED_TO_USER);
	}
	public void bindingWithdrawCash(RechargeParam params, VolleyListener listener) {
		postCharge(ApiConfig.APIURL.URL_BANGDING_TX,
				ApiConfig.APIURL.URL_BANGDING_TX, params, listener);
		tags.add(ApiConfig.APIURL.URL_BANGDING_TX);
	}
	public void checkCouns(RechargeParam params, VolleyListener listener) {
		postCharge(ApiConfig.APIURL.URL_CHECK_TX,
				ApiConfig.APIURL.URL_CHECK_TX, params, listener);
		tags.add(ApiConfig.APIURL.URL_CHECK_TX);
	}
	public void getCode2(UserParam params, VolleyListener listener) {
		postCharge1(ApiConfig.APIURL.URL_GETCODE2,
				ApiConfig.APIURL.URL_GETCODE2, params, listener);
		tags.add(ApiConfig.APIURL.URL_GETCODE2);
	}
	public void submit(RechargeParam params, VolleyListener listener) {
		postCharge(ApiConfig.APIURL.URL_SUBMINT,
				ApiConfig.APIURL.URL_SUBMINT, params, listener);
		tags.add(ApiConfig.APIURL.URL_SUBMINT);
	}

	public void TixianList(RechargeParam params, VolleyListener listener) {
		postCharge(ApiConfig.APIURL.URL_TIXIAN,
				ApiConfig.APIURL.URL_TIXIAN, params, listener);
		tags.add(ApiConfig.APIURL.URL_TIXIAN);
	}




	public void cancelAll() {
		for (String tag : tags) {
			cancel(tag);
		}
	}

}
